# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.PrivateCA.V1.Model.CertificateConfig do
  @moduledoc """
  A CertificateConfig describes an X.509 certificate or CSR that is to be created, as an alternative to using ASN.1.

  ## Attributes

  *   `publicKey` (*type:* `GoogleApi.PrivateCA.V1.Model.PublicKey.t`, *default:* `nil`) - Optional. The public key that corresponds to this config. This is, for example, used when issuing Certificates, but not when creating a self-signed CertificateAuthority or CertificateAuthority CSR.
  *   `subjectConfig` (*type:* `GoogleApi.PrivateCA.V1.Model.SubjectConfig.t`, *default:* `nil`) - Required. Specifies some of the values in a certificate that are related to the subject.
  *   `subjectKeyId` (*type:* `GoogleApi.PrivateCA.V1.Model.CertificateConfigKeyId.t`, *default:* `nil`) - Optional. When specified this provides a custom SKI to be used in the certificate. This should only be used to maintain a SKI of an existing CA originally created outside CA service, which was not generated using method (1) described in RFC 5280 section 4.2.1.2.
  *   `x509Config` (*type:* `GoogleApi.PrivateCA.V1.Model.X509Parameters.t`, *default:* `nil`) - Required. Describes how some of the technical X.509 fields in a certificate should be populated.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :publicKey => GoogleApi.PrivateCA.V1.Model.PublicKey.t() | nil,
          :subjectConfig => GoogleApi.PrivateCA.V1.Model.SubjectConfig.t() | nil,
          :subjectKeyId => GoogleApi.PrivateCA.V1.Model.CertificateConfigKeyId.t() | nil,
          :x509Config => GoogleApi.PrivateCA.V1.Model.X509Parameters.t() | nil
        }

  field(:publicKey, as: GoogleApi.PrivateCA.V1.Model.PublicKey)
  field(:subjectConfig, as: GoogleApi.PrivateCA.V1.Model.SubjectConfig)
  field(:subjectKeyId, as: GoogleApi.PrivateCA.V1.Model.CertificateConfigKeyId)
  field(:x509Config, as: GoogleApi.PrivateCA.V1.Model.X509Parameters)
end

defimpl Poison.Decoder, for: GoogleApi.PrivateCA.V1.Model.CertificateConfig do
  def decode(value, options) do
    GoogleApi.PrivateCA.V1.Model.CertificateConfig.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.PrivateCA.V1.Model.CertificateConfig do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
